package com.backend.service.serviceImpl;

import com.backend.entity.CarFlow;
import com.backend.entity.Vehicle;
import com.backend.entity.Warn;
import com.backend.mapper.WebMapper;
import com.backend.service.WebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class WebServiceImpl implements WebService {
    @Autowired
    private WebMapper webMapper;


    @Override
    public List<CarFlow> listAll(Integer pageNumber, Integer pageSize) {
        pageNumber = (pageNumber - 1)* pageSize;
        return webMapper.listAll(pageNumber,pageSize);
    }

    @Override
    public long listAllNum() {
        return webMapper.listAllNum();
    }

    @Override
    public List<Warn> listAllWarn(Integer pageNumber, Integer pageSize) {
        pageNumber = (pageNumber - 1)* pageSize;
        return webMapper.listAllWarn(pageNumber,pageSize);
    }

    @Override
    public long listAllWarnNum() {
        return webMapper.listAllWarnNum();
    }

    @Override
    public List<Vehicle> listAllVehicle(Integer pageNumber, Integer pageSize) {
        pageNumber = (pageNumber - 1)* pageSize;
        return webMapper.listAllVehicle(pageNumber,pageSize);
    }

    @Override
    public long listAllVehicleNum() {
        return webMapper.listAllVehicleNum();
    }

    @Override
    public List<CarFlow> listByTimeAndSpot(LocalDateTime beginTime, LocalDateTime endTime, String spot, Integer pageNumber, Integer pageSize) {
        pageNumber = (pageNumber - 1)* pageSize;
        return webMapper.listByTimeAndSpot(beginTime,endTime,spot,pageNumber,pageSize);
    }

    @Override
    public long listByTimeAndSpotNum(LocalDateTime beginTime, LocalDateTime endTime, String spot) {
        return webMapper.listByTimeAndSpotNum(beginTime,endTime,spot);
    }
}
